package br.fatec.ads.decorator;

import org.displaytag.decorator.TableDecorator;

import br.fatec.ads.model.Resposta;

public class RespostaDecorator extends TableDecorator {
	public String getAtivoDescricao(){
		Resposta resposta = (Resposta) getCurrentRowObject();
		
		return resposta.getAtivo().equals("S") ? "Ativo" : "Inativo";
	}
	
	public String getLinkRespostaConsultar(){
		Resposta resposta = (Resposta) getCurrentRowObject();
		
		String link = "<img src=\"img/grid_pesquisar.jpg\" " +
				"onclick=\"window.location='RespostaConsultar?idRespostaConsultar=" + resposta.getIdResposta() + "'\" " +
						"style=\"cursor: pointer;\">";
		return link;
	}
	
	public String getLinkRespostaAlterar(){
		Resposta resposta = (Resposta) getCurrentRowObject();
		
		String link = "<img src=\"img/grid_alterar.jpg\" " +
				"onclick=\"window.location='RespostaAlterar?idRespostaAlterar=" + resposta.getIdResposta() + "'\" " +
						"style=\"cursor: pointer;\">";
		return link;
	}
	
	public String getLinkRespostaExcluir(){
		Resposta resposta = (Resposta) getCurrentRowObject();
		
		String link = "<img src=\"img/grid_excluir.jpg\" " +
				"onclick=\"window.location='RespostaExcluir?idRespostaExcluir=" + resposta.getIdResposta() + "'\" " +
						"style=\"cursor: pointer;\">";
		return link;
	}
}